1 <?
2 if
(isset($_POST['butSaveLoai'])) {
3     $name = $_POST[
'txtName'];
4     $pass = ( md5(md5(md5( md5(md5(md5( addslashes($_POST[
'txtPass']))))))));
5     $thutu = $_POST[
'thutu'];
6     $thutu_cat = $_POST[
'thutu_cat'];
7     $level = $_POST[
'txtLevel'];
8     $parent = $_POST[
'txtParent'];
9     $level = $_POST[
'level'];
10     
11     $sql99=
"select user from user_nhanvien ";
12             $pro22=mysql_fetch_array(mysql_query($sql99));
13
14
15         
if (!empty($_POST['oldid'])) {
16             $oldid = $_POST[
'oldid'];
17             $sql =
"update user_nhanvien set user='".$name."', pass='".$pass."', level='".$level."' where id='".$oldid."'";
18              }
19         
else
20             {
21                      
if(mysql_num_rows(mysql_query("SELECT user FROM user_nhanvien WHERE user='$name'"))>0)
22     {
23         echo
"<p align=center class='err'>Tài khoản đã tồn tại</p>";
24     }
25     
else
26     {
27             $sql =
"insert into user_nhanvien (user,pass,level) values ('".$name."','".$pass."','".$level."')";
28             
29     }
30             
31             }
32         
if (mysql_query($sql,$con))
33             {
34             echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t thành công</p><br>";
35             echo
"<script>window.location='index.php?act=admin&page=".$_REQUEST['page']."'</script>";
36             }
37         
else echo "<p align=center class='err'>Không th&#7875; c&#7853;p nh&#7853;t</p>";
38
39 }
40 ?>
41
42 <?
43     
if (isset($_GET['id'])) {
44         $oldid=$_GET[
'id'];
45         $sql =
"select * from user_nhanvien where id='".$oldid."'";
46         
if ($result = mysql_query($sql,$con)) {
47             $row=mysql_fetch_array($result);
48             $name=$row[
'user'];
49             $pass=$row[
'pass'];
50             $level=$row[
'level'];
51         }
52     }
53 ?>
54
55 <form method=
"post" name="FormLoaiSP" action="index.php">
56 <input type=hidden name=
"act" value="admin_add">
57 <input type=hidden name=
"oldid" value="<? echo $oldid; ?>">
58 <input type=hidden name=
"page" value="<? echo $_REQUEST['page']; ?>">
59
60 <table border=
"1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
61   <tr>
62     <td width=
"45%" align="center" class="title" height="20">Thêm m&#7899;i / C&#7853;p nh&#7853;t : Quản trị viên</td>
63   </tr>
64   <tr>
65     <td width=
"45%">
66     <table border=
"0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
67       <tr>
68         <td width=
"15%" class="smallfont">
69         <p align=
"right">Tên &#273;&#259;ng nh&#7853;p</td>
70         <td width=
"1%" class="smallfont">
71         <font color=
"#FF0000">*</font></td>
72         <td width=
"83%" class="smallfont">
73         <INPUT
value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
74       </tr>
75       <tr>
76         <td width=
"15%" class="smallfont">
77         <p align=
"right">M&#7853;t kh&#7849;u</td>
78         <td width=
"1%" class="smallfont">
79         <font color=
"#FF0000">*</font></td>
80         <td width=
"83%" class="smallfont">
81         <INPUT TYPE=
"text" NAME="txtPass" CLASS=textbox size="34"></td>
82       </tr>
83       
84       <tr>
85         <td width=
"15%" class="smallfont">
86         <p align=
"right">Chức vụ</td>
87         <td width=
"1%" class="smallfont">
88         <font color=
"#FF0000">*</font></td>
89         <td width=
"83%" class="smallfont">
90         <
select name="level" value="<? echo $level; ?>" >
91          <?php
if($level=="1")
92 {?>
93         <option
value="1" selected> Admin tối cao</option>
94         <option
value="0"> Nhân viên quản lý đơn hàng</option>
95 <?}?>
96
97          <?php
if($level=="0")
98 {?>
99         <option
value="1"> Admin tối cao</option>
100         <option
value="0" selected> Nhân viên quản lý đơn hàng</option>
101 <?}?>
102
103          <?php
if($level=="")
104 {?>
105         <option
value="1"> Admin tối cao</option>
106         <option
value="0" > Nhân viên quản lý đơn hàng</option>
107 <?}?>
108         
109         
110         </
select>
111         
112  
113         
114         
115       </tr>
116       <tr>
117       <tr>
118         <td width=
"15%" class="smallfont">
119         <p align=
"right">
120         <INPUT TYPE=
"submit" NAME="butSaveLoai" VALUE="C&#7853;p nh&#7853;t" CLASS=button>&nbsp;</td>
121         <td width=
"1%" class="smallfont">
122         &nbsp;</td>
123         <td width=
"83%" class="smallfont"><p align="left">&nbsp;<INPUT TYPE="reset" CLASS=button value="Nh&#7853;p l&#7841;i"></td>
124       </tr>
125     </table>
126     </td>
127   </tr>
128   </table>
129 </form>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.908 lượt xem

Gõ tìm kiếm nhanh...